const str1 = 'foo bar'

console.log(str1.match(/(foo)\s+(bar)/))
console.log(str1.match(/(?:foo)\s+(bar)/))
console.log('------------')

const str2 = 'abcd1j452h'
console.log(str2.match(/([a-zA-Z]+)(?:1|2)([a-zA-Z]+)/))
console.log('------------')

const str3 = 'bg.png index.html bg2.jpeg test.png'
console.log(str3.match(/\w+(?=\.png)/g))
console.log('------------')

const str4 = '12a12b12c22222'
const reg = /\d+[abc]/g
console.log(reg.test(str4))
console.log(reg.lastIndex)
console.log(reg.test(str4))
console.log(reg.lastIndex)
console.log('-------------')

const str5 = '12a12b12c12d11111'
console.log(str5.match(/\d+[a-z]/))
console.log(str5.match(/\d+[a-z]/))
